﻿using System;
using System.ComponentModel;
using GBL.Repository.Resources;

namespace GBlason.ViewModel.CoatOfArm
{
    public class EditableResourceViewModel : INotifyPropertyChanged
    {
        private String _name;
        private ResourceType _typeOfResource;
        private String _description;

        public string Description
        {
            get { return _description; }
            set
            {
                if (_description == value) return;
                _description = value;
                OnPropertyChanged("Description");
            }
        }

        public ResourceType TypeOfResource
        {
            get { return _typeOfResource; }
            set
            {
                if (_typeOfResource == value) return;
                _typeOfResource = value;
                OnPropertyChanged("Type");
            }
        }

        public string Name
        {
            get { return _name; }
            set
            {
                if (_name == value) return;
                _name = value;
                OnPropertyChanged("Name");
            }
        }

        #region INotifyPropertyChanged Members

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

    }
}
